import {dataHandle} from '../initTemplate';
import requestApi from '../requestApi';


export default function () {
    let props = this.props;
    let billdata =  props.createMasterChildData(window.presetVar.pageId, window.presetVar.head.head1, window.presetVar.body.body1);
    let billId = billdata.head.head.rows[0].values.pk_mtapp_bill.value || props.getUrlParam('id') || "";
        requestApi.query({
            data: {
                "openbillid": billId,
                "pagecode": window.presetVar.pageCode
            },
            success: (data) => {
                //处理按钮状态
                dataHandle.call(this, data.data.head[window.presetVar.head.head1],props);

                props.form.setAllFormValue({[window.presetVar.head.head1]: data.data.head[window.presetVar.head.head1]});
                //设置表体数据
                for (let bodyKey in window.presetVar.body) {
                    props.cardTable.setTableData(window.presetVar.body[bodyKey], data.data.bodys[window.presetVar.body[bodyKey]]);
                }
                this.pubMessage.refreshSuccess();

           }
        })

}
